﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace 接口
{
    public struct Film
    {
        public string Name;
        public decimal Price;

        public override string ToString()
        {
            return Name;
        }
    }
    public interface ISaleTicket
    {
        decimal GetPrice(Film film);
    }
    public class Cinema:ISaleTicket
    {
        decimal ISaleTicket.GetPrice(Film film)
        {
            return film.Price;
        }
        public decimal GetPrice(Film film)
        {
            return film.Price * 0.9M;
        }
        public override string ToString()
        {
            return "电影院";
        }
    }
    public class Agent:ISaleTicket
    {
        public decimal GetPrice(Film film)
        {
            if (film.Price >= 80)
                return film.Price * 0.85M;
            else
                return film.Price;
        }
        public override string ToString()
        {
            return "代理商";
        }
    }
    public class WebShop : ISaleTicket
    {
        public decimal GetPrice(Film film)
        {
            if (film.Price >= 100)
                return film.Price * 0.8M;
            else if(film.Price >= 50)
                return film.Price * 0.9M;
            else
                return film.Price * 0.95M;
        }
        public override string ToString()
        {
            return "网上商店";
        }
    }
}
